package com.wx.mall.goods.feign;

import com.alibaba.fastjson.JSON;
import com.wx.mall.common.vo.goods.SkuVo;
import com.wx.mall.goods.entity.Sku;
import com.wx.mall.goods.service.ISkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@RestController
@RequestMapping("/skufeign")
@Api(tags = "sku表feign调用")
@Slf4j
public class SkuFeignController {

    @Autowired
    private ISkuService service;

    @GetMapping("/listById")
    @ApiOperation("通过SKU ID 获取商品SKU数据")
    public SkuVo listById(Integer id) {
        Sku sku=service.getById(id);
        SkuVo vo=new SkuVo();

        vo.setId(sku.getId());
        vo.setEncode(sku.getEncode());
        vo.setName(sku.getName());
        vo.setPrice(sku.getPrice());
        vo.setRepertory(sku.getRepertory());
        vo.setWarning(sku.getWarning());
        vo.setImage(sku.getImage());
        vo.setImages(sku.getImages());
        vo.setSpuId(sku.getSpuId());
        vo.setSpec(sku.getSpec());
        vo.setSale(sku.getSale());
        vo.setComment(sku.getComment());
        vo.setStatus(sku.getStatus());
        return vo;
    };




}
